﻿/*
#------------------------------------------------------------------------------
#-- Program Name:	[dbo].[spRest_GetAllBackups]
#-- Purpose:		Provides a mechanism query for a full list of database backups
#--	Last Update:	04/25/2013
#--					For a complete history - please review comments in SVN
#-- Called By:		Restore Database Utility Executable
#------------------------------------------------------------------------------
*/
CREATE PROCEDURE [dbo].[spRest_GetAllBackups]
(
	@database_name		sysname,
	@start_date			datetime		= NULL,
	@label				nvarchar(255)	= NULL,
	@files_must_exist	bit				= 1,
	@recovery_window	bit				= 1
)
AS

SET NOCOUNT ON

SELECT		id,
			recovery_path_broken,
			backup_set_id,
			db_backup_set_id,
			prev_tlog_backup_set_id,
			database_name,
			name,
			type,
			backup_start_date,
			has_bulk_logged_data,
			backup_size,
			physical_device_name,
			file_exists,
			database_backup_lsn,
			differential_base_lsn,
			checkpoint_lsn,
			fork_point_lsn,
			first_lsn,
			last_lsn,
			first_recovery_fork_guid,
			last_recovery_fork_guid
FROM		[dbo].[fnBkp_GetAllBackups](@database_name, @start_date, @label, @files_must_exist, @recovery_window)

SET NOCOUNT OFF
